Charlottesville region 2018 LODES data exploration

Data source

Data specifics

Variable descriptions

meta %>% 
  filter(su_blkgp == 1) %>%
  select(description) %>% as.list()
## $description
##  [1] "# of low-wage jobs in the su (earnings $1250/month or less )"                   
##  [2] "# of mid-wage jobs in the su (earnings $1251/month to $3333/month)"             
##  [3] "# of high-wage jobs in the su (earnings greater than $3333/month)"              
##  [4] "Total # of jobs in the su"                                                      
##  [5] "Total # of workers who live in the su"                                          
##  [6] "Total # of workers who live in the su divided by the total # of jobs in the su" 
##  [7] "# of low-wage jobs in the su divided by the total # of jobs in the su"          
##  [8] "# of mid-wage jobs in the su divided by the total # of jobs in the su"          
##  [9] "# of high-wage jobs in the su divided by the total # of jobs in the su"         
## [10] "# of White alone workers employed in the su"                                    
## [11] "# of Black alone workers employed in the su"                                    
## [12] "# of American Indian or Alaska Native alone workers employed in the su"         
## [13] "# of Asian alone workers employed in the su"                                    
## [14] "# of Native Hawaiian or Other Pacific Islander alone workers employed in the su"
## [15] "# of workers employed in the su who identify as two or more race groups"        
## [16] "# of jobs for workers with less than a high school education"                   
## [17] "# of jobs for workers with a high school educaiton but no college"              
## [18] "# of jobs for workers with some college or an Associates degree"                
## [19] "# of jobs for workers with a Bachelor's or advanced degree"                     
## [20] "5-digit county code"                                                            
## [21] "12-digit census block group code"                                               
## [22] "County name"
glimpse(lodes)
## Rows: 155
## Columns: 20
## $ w_blkgroup               <dbl> 510030101001, 510030101002, 510030101003, 510…
## $ lowwage_jobs             <int> 44, 81, 49, 48, 118, 33, 37, 205, 14, 440, 20…
## $ midwage_jobs             <int> 58, 83, 63, 73, 177, 40, 96, 157, 52, 783, 49…
## $ higwage_jobs             <int> 41, 55, 60, 258, 181, 39, 108, 90, 63, 1782, …
## $ alljobs                  <int> 143, 219, 172, 379, 476, 112, 241, 452, 129, …
## $ lowwage_p                <dbl> 0.3076923, 0.3698630, 0.2848837, 0.1266491, 0…
## $ midwage_p                <dbl> 0.4055944, 0.3789954, 0.3662791, 0.1926121, 0…
## $ higwage_p                <dbl> 0.2867133, 0.2511416, 0.3488372, 0.6807388, 0…
## $ White_workers            <int> 128, 204, 149, 296, 316, 96, 207, 371, 108, 2…
## $ Black_workers            <int> 12, 11, 13, 55, 115, 10, 26, 64, 19, 354, 12,…
## $ AI_Na_workers            <int> 1, 0, 0, 1, 0, 0, 2, 1, 0, 6, 0, 0, 0, 0, 2, …
## $ Asian_workers            <int> 0, 2, 9, 20, 31, 2, 2, 14, 1, 148, 3, 10, 3, …
## $ NaH_PI_workers           <int> 0, 0, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ Multiracial_workers      <int> 2, 2, 0, 6, 12, 2, 4, 2, 1, 46, 3, 0, 2, 4, 7…
## $ lessThanHS_jobs          <int> 20, 25, 17, 34, 42, 17, 25, 38, 16, 217, 11, …
## $ HSnoCollege_jobs         <int> 36, 46, 42, 97, 109, 19, 56, 73, 26, 574, 24,…
## $ SomeColl_Associates_jobs <int> 32, 60, 42, 89, 115, 27, 73, 98, 32, 688, 31,…
## $ Bach_AdvDeg_jobs         <int> 14, 45, 36, 98, 82, 29, 42, 93, 30, 825, 23, …
## $ w_county                 <int> 51003, 51003, 51003, 51003, 51003, 51003, 510…
## $ countyName               <chr> "Albemarle", "Albemarle", "Albemarle", "Albem…
lodes %>% select(lowwage_jobs:Bach_AdvDeg_jobs) %>% 
  select(where(~is.numeric(.x))) %>% 
  as.data.frame() %>% 
  stargazer(., type = "text", title = "Summary Statistics", digits = 2,
            summary.stat = c("mean", "sd", "min", "median", "max"))
## 
## Summary Statistics
## ===========================================================
## Statistic                 Mean  St. Dev. Min  Median  Max  
## -----------------------------------------------------------
## lowwage_jobs             175.44  313.91   1     72   2,352 
## midwage_jobs             238.54  439.40   0     98   3,086 
## higwage_jobs             346.51 1,034.46  0     83   9,734 
## alljobs                  760.49 1,714.50  10   284   14,612
## lowwage_p                 0.29    0.13   0.06  0.29   0.82 
## midwage_p                 0.37    0.10   0.00  0.38   0.70 
## higwage_p                 0.34    0.16   0.00  0.31   0.83 
## White_workers            598.00 1,346.47  1    223   11,566
## Black_workers            118.08  245.58   0     38   1,615 
## AI_Na_workers             2.28    4.59    0     1      37  
## Asian_workers            28.63   105.72   0     6    1,146 
## NaH_PI_workers            0.52    1.41    0     0      11  
## Multiracial_workers      12.98   30.20    0     4     237  
## lessThanHS_jobs          63.95   116.09   0     30    878  
## HSnoCollege_jobs         150.65  287.01   1     64   2,235 
## SomeColl_Associates_jobs 174.17  391.33   0     65   3,072 
## Bach_AdvDeg_jobs         197.86  592.62   0     56   5,950 
## -----------------------------------------------------------
loch_missingness_monster(lodes)
## There are 0 missing values in the dataset 
## The maximum number of values that any variable is missing is 0 
##  
## Number of missing values per variable: 
##  w_blkgroup lowwage_jobs midwage_jobs higwage_jobs alljobs lowwage_p midwage_p
##           0            0            0            0       0         0         0
##  higwage_p White_workers Black_workers AI_Na_workers Asian_workers
##          0             0             0             0             0
##  NaH_PI_workers Multiracial_workers lessThanHS_jobs HSnoCollege_jobs
##               0                   0               0                0
##  SomeColl_Associates_jobs Bach_AdvDeg_jobs w_county countyName
##                         0                0        0          0

Histograms

lodes %>% select(c(w_blkgroup:alljobs)) %>% 
  pivot_longer(-w_blkgroup, names_to = "measure", values_to = "value") %>% 
  ggplot(aes(x = value, fill = measure)) + 
  scale_fill_viridis(option = "plasma", discrete = TRUE, guide = FALSE) +
  geom_histogram() + 
  facet_wrap(~measure, scales = "free")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Mapping the data

## [1] TRUE

All jobs

pal <- colorNumeric("plasma", reverse = TRUE, domain = cvl_lodes$alljobs)
leaflet(cvl_lodes) %>% 
  addProviderTiles("CartoDB.Positron") %>% 
  addPolygons(data = cvl_lodes,
              fillColor = ~pal(alljobs),
              weight = 1,
              opacity = 1,
              color = "white", 
              fillOpacity = 0.6,
              highlight = highlightOptions(
                weight = 1, fillOpacity = 0.8, bringToFront = T
              ),
              popup = paste0("Block Group: ", cvl_lodes$BLKGRPCE, "<br>",
                             "Number of jobs: ", cvl_lodes$alljobs, 2)) %>% 
  addLegend("bottomright", pal = pal, values = cvl_lodes$alljobs, 
            title = "Number of jobs", opacity = 0.7)

Wages

pal <- colorNumeric("plasma", reverse = TRUE, domain = cvl_lodes$lowwage_p)
leaflet(cvl_lodes) %>% 
  addProviderTiles("CartoDB.Positron") %>% 
  addPolygons(data = cvl_lodes,
              fillColor = ~pal(lowwage_p),
              weight = 1,
              opacity = 1,
              color = "white", 
              fillOpacity = 0.6,
              highlight = highlightOptions(
                weight = 1, fillOpacity = 0.8, bringToFront = T
                ),
              popup = paste0("Block Group: ", cvl_lodes$BLKGRPCE, "<br>",
               "Prop. low-wage jobs: ", round(cvl_lodes$lowwage_p, 2))) %>% 
  addLegend("bottomright", pal = pal, values = cvl_lodes$lowwage_p, 
            title = "Proportion of low wage jobs", opacity = 0.7)
# High wage jobs
pal <- colorNumeric("plasma", reverse = TRUE, domain = cvl_lodes$higwage_p)
leaflet(cvl_lodes) %>% 
  addProviderTiles("CartoDB.Positron") %>% 
  addPolygons(data = cvl_lodes,
              fillColor = ~pal(higwage_p),
              weight = 1,
              opacity = 1,
              color = "white", 
              fillOpacity = 0.6,
              smoothFactor = 0.3,
              highlight = highlightOptions(
                weight = 1, fillOpacity = 0.8, bringToFront = T
              ),
              popup = paste0("Block Group: ", cvl_lodes$BLKGRPCE, "<br>",
                             "Prop. high-wage jobs: ", round(cvl_lodes$higwage_p, 2))) %>% 
  addLegend("bottomright", pal = pal, values = cvl_lodes$higwage_p, 
            title = "Proportion of high-wage jobs", opacity = 0.7)

Education

pal <- colorNumeric("plasma", reverse = TRUE, domain = cvl_lodes$Bach_AdvDeg_jobs)
leaflet(cvl_lodes) %>% 
  addProviderTiles("CartoDB.Positron") %>% 
  addPolygons(data = cvl_lodes,
              fillColor = ~pal(Bach_AdvDeg_jobs),
              weight = 1,
              opacity = 1,
              color = "white", 
              fillOpacity = 0.6,
              smoothFactor = 0.3,
              highlight = highlightOptions(
                weight = 1, fillOpacity = 0.8, bringToFront = T
              ),
              popup = paste0("Block Group: ", cvl_lodes$BLKGRPCE, "<br>",
                             "Number of jobs: ", cvl_lodes$Bach_AdvDeg_jobs)) %>% 
  addLegend("bottomright", pal = pal, values = cvl_lodes$Bach_AdvDeg_jobs, 
            title = "Number of jobs for college-educated workers", opacity = 0.7)